package com.sxhalo.manage.service.impl;

import java.util.List;

import com.sxhalo.manage.dao.TaskLogDAO;
import com.sxhalo.manage.map.TaskLog;
import com.sxhalo.manage.service.IBaseService;
import com.sxhalo.manage.utils.Pager;

public class TaskLogServiceImpl implements IBaseService<TaskLog> {

	private TaskLogDAO myDao;

	public TaskLogDAO getMyDao() {
		return myDao;
	}

	public void setMyDao(TaskLogDAO myDao) {
		this.myDao = myDao;
	}

	@Override
	public void save(TaskLog entity) {
		myDao.save(entity);

	}

	@Override
	public void update(TaskLog entity) {
		myDao.merge(entity);

	}

	@Override
	public Boolean delete(TaskLog entity) {
		try {
			myDao.delete(entity);
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	@Override
	public Boolean delete(Integer id) {
		try {
			TaskLog entity = new TaskLog();
			entity.setTaskLogId(id);
			myDao.delete(entity);
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	@Override
	public void service() {
		// TODO Auto-generated method stub

	}

	@Override
	public TaskLog findById(Object id) {
		return myDao.findById(Integer.parseInt(id.toString()));
	}

	@Override
	public TaskLog find(String fieldName, Object fieldValue) {
		List<TaskLog> list = findList(fieldName, fieldValue);
		return list.size() > 0 ? list.get(0) : null;
	}

	@Override
	public List<TaskLog> findList(String fieldName, Object fieldValue) {
		return myDao.findByProperty(fieldName, fieldValue);
	}

	@Override
	public List<TaskLog> findAll() {
		return myDao.findAll();
	}

	@Override
	public List<TaskLog> findListByIds(List<String> idList) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Pager<TaskLog> findPagerList(int pageNumber, int pageSize,
			String whereStr, String orderStr) {
		return myDao.findPagerList(pageNumber, pageSize, whereStr);
	}

	@Override
	public List<TaskLog> findByExample(Object instance) {
		// TODO Auto-generated method stub
		return null;
	}

}
